<template>
  <div class="sec-statistic">
    <div class="title">{{ $attrs.title }}</div>
    <div class="num">{{ $attrs.count || 0 }}</div>
    <div class="percent">
      <span style="margin-right: 10px">
        周同比<i class="el-icon-caret-top" v-if="weekIncrease" :class="{ increase: weekIncrease }"></i
        ><i class="el-icon-caret-bottom" v-else :class="{ increase: weekIncrease }"></i
        >{{ Math.abs(weekPercent) * 100 }}%
      </span>
      <span>
        日环比<i class="el-icon-caret-top" v-if="dayIncrease" :class="{ increase: dayIncrease }"></i
        ><i class="el-icon-caret-bottom" v-else :class="{ increase: dayIncrease }"></i>{{ Math.abs(dayPercent) * 100 }}%
      </span>
    </div>
  </div>
</template>

<script>
export default {
  name: "secStatistic",
  props: {
    dayPercent: {
      type: Number,
      default: 0,
    },
    weekPercent: {
      type: Number,
      default: 0,
    },
  },
  components: {},
  data() {
    return {};
  },
  computed: {
    dayIncrease() {
      return this.dayPercent >= 0 ? true : false;
    },
    weekIncrease() {
      return this.weekPercent >= 0 ? true : false;
    },
  },
  mounted() {},
  methods: {},
  watch: {},
};
</script>
<style lang="scss" scoped>
//@import url(); 引入公共css类
.sec-statistic {
  border: 1px solid #e4e7ed;
  border-radius: 4px;
  padding: 10px;
  box-shadow: 0 2px 4px 0 rgba(14, 40, 107, 0.06);
  margin-bottom: 5px;
  .title {
    font-size: 13px;
    // color: #666;
  }
  .num {
    font-size: 22px;
    line-height: 35px;
    font-weight: 600;
  }
  .percent {
    i {
      color: #f56c6c;
      margin: 0 3px;
      &.increase {
        color: #409eff;
      }
    }
  }
}
</style>
